home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Oct. 31/97
- // Author: clm
- //
- // Description:
- // animSweep operates on NURBS curves, generally that are animated.
- // It will take snapshots of the curve at each of the times between a
- // min and max time with an increment, copy the curves
- //
- // Input Arguments:
- // float minTime - start time of sweep
- // float maxTime - end time of sweep
- // int ts - if true, use the time slider range for the
- // min/max times of the sweep; otherwise use
- // minTime and maxTime.
- // float by - increment for snapshot of objects to sweep
- // float hist - if true, keep history on after the sweep is
- // finished, so that changes to the original
- // animated object will affect the swept object
- // int deg - degree of swept surface produced
- // int uniform - if true, make the swept surface w. uniform knots
- // int close - if true, make the swept surface closed
- // int poly - if true, make the swept surface a polygonal object
- //
- // Return Value:
- // Returns the number of swept surfaces that were produced
- // (one per selected animated curve)
- //
-
-
- proc int animSweepOne(string $curve, float $minTime, float $maxTime, int $ts,
- float $by, int $hist, int $deg, int $uniform, int $close, int $poly)
- {
- // Note that we want to query the time slider range at the time we
- // execute the command, so that if the action was dragged to the
- // shelf, it will re-query the time slider range each time it is executed.
- //
- if ($ts == 1)
- {
- $minTime = `playbackOptions -query -minTime`;
- $maxTime = `playbackOptions -query -maxTime`;
- }
-
- string $result[] = `snapshot -startTime $minTime -endTime $maxTime
- -increment $by -constructionHistory $hist $curve`;
-
- if (size($result) == 0)
- {
- error(("could not snapshot '"+$curve+"'"));
- return 0;
- }
-
- // Do the loft
- //
- if (catch (`loft
- -uniform $uniform -close $close
- -degree $deg -polygon $poly
- -ch $hist
- $result[0]`))
- {
- error(("could not loft result of snapshot '"+$curve+"'"));
- return 0;
- }
-
- // If construction history is off, delete the curves that snapshot
- // generated (which will also delete the snapshot node)
- //
- if (!$hist)
- {
- delete $result[0];
- }
-
- return 1;
- }
-
- global proc int animSweep(float $minTime, float $maxTime, int $ts,
- float $by, int $hist,
- int $deg, int $uniform, int $close, int $poly)
- {
- // Walk through all the shapes on the selection list, and
- // anim sweep all the nurbsCurve shapes
- //
- int $processed = 0;
- string $result[] = `ls -sl -dag -lf -showType`;
- for ($i = 0; $i < size($result); $i+=2)
- {
- if ($result[$i+1] == "nurbsCurve")
- {
- animSweepOne($result[$i], $minTime, $maxTime, $ts, $by, $hist,
- $deg, $uniform, $close, $poly);
- $processed = 1;
- }
- }
-
- if ($processed == 0)
- warning("No curves to Animation Sweep");
-
- return 1;
- }
-